<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>数据字典管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <#include "../../include/layui.ftl" />
    <#include "../../include/pTable.ftl" />
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <form  id="queryForm">
                <input type="hidden" id="className" name="className" value="${className!}" />
                <input type="hidden" id="modleName" name="modleName" value="${modleName!}" />
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">字典编码</label>
                        <div class="layui-input-block">
                            <input type="text" name="dicCode" placeholder="请输入" autocomplete="off" class="layui-input">
                            <input type="hidden" name="dicCode_searchType" value="like">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">字典名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="dicName" placeholder="请输入" autocomplete="off" class="layui-input">
                            <input type="hidden" name="dicName_searchType" value="like">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">字典值</label>
                        <div class="layui-input-block">
                            <input type="text" name="dicValue" placeholder="请输入" autocomplete="off" class="layui-input">
                            <input type="hidden" name="dicValue_searchType" value="like">
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div class="layui-card-body">
            <table id="lay-table" lay-filter="lay-table"></table>
            <script type="text/html" id="toolbar"></script>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: '${path}/plug-in/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','tables','treeGrid','layers'],function () {
        var tables = layui.tables,
            treeGrid = layui.treeGrid,
            table = layui.table,
            layers = layui.layers,
            $ = layui.$;
        var parmer = {
            where:{sort : ''},
            treeShowName:'dicName',
            cols: [[
                {field:"dicName",width:180,title:"字典名称" },
                {field:"dicCode",width:180,title:"字典编码" },
                {field:"parCode",width:170,title:"父字典编码" },
                {field:"dicValue",width:100,title:"字典值" },
                {field:"dicOrder",width:100,title:"字典排序" },
            ]],
            onClickRow:function (index, o, that) {//单机事件
                var $tr = $(".layui-table tbody tr");
                $tr.removeClass("layui-table-click");
                that.getTr(index).addClass("layui-table-click");
                p.data = o;
            }
        };
        var $tables = tables.treeTable(parmer);

        //头工具栏事件
        $(".layui-table-tool .layui-btn-group .layui-btn").on("click",function() {
            var event = $(this).attr("lay-event");
            switch(event){
                case '01':
                    layers.add({
                        treeTable:$tables,
                        area:['600px', '430px'],
                        data: p.data
                    });
                    break;
                case '02':
                    layers.edit({
                        treeTable:$tables,
                        area:['600px', '325px'],
                        data: p.data
                    });
                    break;
                case '03':
                    layers.delete({
                        treeTable:$tables,
                        data: p.data
                    });
                    break;
                case '05':
                    var where = $("#queryForm").serializeObject();
                    where = $.extend({},where,$tables.config.where);
                    treeGrid.query("lay-table",{
                        where: where
                    });
                    break;
                case '25':
                    layers.edit({
                        title:'菜单动作配置',
                        treeTable:$tables,
                        area:['600px', '500px'],
                        content:'/console/menu/rewrite/toConfig',
                        data: p.data
                    });
                    break;
            };
        });
    });
</script>
</body>
</html>